﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Bai01
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            int[] list1 = new int[12];
            for (int i = 0; i < 12; i++)
            {
                list1[i] = i + 1;
            }
            comboBoxThang.DataSource = list1;
            int[] list2 = new int[2];
            for (int i = 0; i < 2; i++)
            {
                list2[i] = i + 1;
            }
            comboBoxNV.DataSource = list2;
            string []list3=new string[2];
            list3[0]="Nam";
            list3[1]="Nữ";
            comboBoxGT.DataSource = list3;
            int[] list4 = new int[31];
            for (int i = 0; i < 31; i++)
            {
                list4[i] = i + 1;
            }
            comboBoxNgay.DataSource = list4;
        }

        private void buttonTN_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Bạn chắc chắn thêm!", "Thoát", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
            {
                NhanVien NV = new NhanVien();
                NV.MaNV = Convert.ToString(textBoxMaNV.Text);
                string t = comboBoxNV.Text.ToString();
                NV.MaLoai = Convert.ToInt32(t);
                string t1 = comboBoxGT.Text.ToString();
                if (t1 == "Nam")
                {
                    NV.GioiTinh = 0;
                }
                else
                    NV.GioiTinh = 1;
                NV.TenNV = Convert.ToString(textBoxTen.Text);
                NV.DiaChi = Convert.ToString(textBoxDC.Text);
                //NV.Ngaysinh = "";
                NV.Ngaysinh = Convert.ToString(comboBoxNgay.Text) + "/" + Convert.ToString(comboBoxThang.Text) + "/" + Convert.ToString(textBoxNam.Text);
                NhanVienBLL.them(NV);
            }
            MessageBox.Show("Them thành công");

        }

        private void textBoxNam_TextChanged(object sender, EventArgs e)
        {

        }

    }
}
